package com.wsseieiei.fireballgame.effects;


import net.minecraft.world.effect.MobEffectCategory;
import net.minecraft.world.entity.LivingEntity;

import static org.apache.commons.lang3.RandomUtils.nextInt;


public class EffectBurn extends BaseEffect{



    public EffectBurn(MobEffectCategory type, int color, boolean isInstant) {

        super(type, color, isInstant);

    }



    //buff隔多久生效一次

    @Override

    protected boolean canApplyEffect(int remainingTicks, int level) {
        if (((int)20/(level+1))>0 && (level<10)){
            return remainingTicks % ((int)20/(level+1))==0;
        }
        else{
            return false;
        }

    }



    //buff在生物身上的效果

    @Override

    public void applyEffectTick(LivingEntity living, int amplified) {

        amplified++;
        if (living.getHealth()>0)
            living.setHealth((float)nextInt(1,20));

    }



    //是不是增益buff

    @Override

    public boolean isBeneficial() {

        return false;

    }



}